package com.enjoyor.soa.traffic.rest.efoms.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.enjoyor.soa.traffic.frame.annotation.Auth;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.ICheckReportConsumService;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Auth
@RestController
@RequestMapping({ "/CheckReport" })
@Api("CheckReportController")
@CrossOrigin
public class CheckReportController {

	@Autowired
	private ICheckReportConsumService iCheckReportConsumService;
	
	@GetMapping(value = { "selectDeviceDetailInfoPage" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("获取巡检报表")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "searchFlag", value = "查询标识（DEVICE：设备维度；PERSON：人员维度）", paramType = "query", dataType = "String")
		})
	public ResultPojo selectDeviceDetailInfoPage(
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "startTime", required = false) String startTime,
			@RequestParam(defaultValue = "", value = "endTime", required = false) String endTime,
			@RequestParam(defaultValue = "", value = "searchFlag", required = false) String searchFlag,
			Page page, HttpServletRequest request) {
		return iCheckReportConsumService.getCheckReport(devTypeCode, startTime, endTime, page, searchFlag);
	}
}
